package com.taotao.search.listener;

import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.springframework.beans.factory.annotation.Autowired;

import com.taotao.search.dao.SearchDao;

public class UpdateMessageListener implements MessageListener{

	@Autowired
	private SearchDao searchDao;
	
	@Override
	public void onMessage(Message message) {
		
		if(message instanceof TextMessage) {
			TextMessage textMessage = (TextMessage)message;
			
			try {
				searchDao.updateSolrFiled(Long.parseLong(textMessage.getText()));
			} catch (Exception e) {
				e.printStackTrace();
			} 
		}
		
	}

}
